#include<iostream>
using namespace std;
const int N = 60;
int st[N];
int n, k;
int main()
{
	cin >> n >> k;
	int pos = 1;
	int cnt = 1;
	st[pos]++;
	while (1) {
		pos = (pos + cnt * k) % n;
		cnt++;
		st[pos]++;
		if (st[pos] == 2)break;
	}
	for (int i = 1; i <= n; i++) {
		if (!st[i]) {
			cout << i << " ";
		}
	}
	return 0;
}